<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-menu default-active='active' mode='horizontal' class='menu-unit'>
          <el-menu-item v-for='item in Container2' :index="'工序流列表'===item.name?'active':'default'">
            <el-link @click="gotoMenu(item.url)" :type="'工序流列表'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
        <table cellpadding="4" cellspacing="0" border="0" width="100%">
          <tr>
            <td class="containerBack">
              <el-form ref="form" :model="s_step" :rules="rules" label-width="100px" id="mvcfm">
                <div class="form-unit">
                  <span class="mvc-title-left"> 工序步骤 </span>
                </div>
                <el-table :data="s_step">
                  <el-table-column label="#" align="center" type='index'>
                  </el-table-column>
                  <el-table-column label="操作" align="center" width='100' type=''>
                    <template slot-scope="scope">
                      <el-dropdown trigger="click">
                        <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                        <el-dropdown-menu slot="dropdown">
                          <el-dropdown-item>
                            <el-link @click="popSetSetingRang('&CMIDstep_id='+scope.row.step_id+'')">设置操作</el-link>
                          </el-dropdown-item>
                        </el-dropdown-menu>
                      </el-dropdown>
                    </template>
                  </el-table-column>
                  <el-table-column label="工序" prop="description">
                  </el-table-column>
                  <el-table-column label="工序条形码" prop="process_barcode">
                  </el-table-column>
                  <el-table-column label="变更状态" prop="process_state">
                  </el-table-column>
                  <el-table-column label="工序描述" prop="process_des">
                  </el-table-column>
                  <el-table-column label="下一步骤" prop="nextstepid_name">
                  </el-table-column>
                  <el-table-column label="执行人" prop="contact_name">
                  </el-table-column>
                  <el-table-column label="时长" prop="check_duration">
                  </el-table-column>
                </el-table>
              </el-form>
            </td>
          </tr>
        </table>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'工艺工序'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    <el-dialog :visible.sync="SetSetingRangVisible" append-to-body>
      <SetSetingRang v-if="SetSetingRangVisible" ref="SetSetingRang" :popparams="popparams"> </SetSetingRang>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import SetSetingRang from "@/views/mes/product/SetSetingRang";
  export default {
    name: 'ProcessFlowRang',
    components: {
      SetSetingRang,
    },
    props: ['popparams'],
    data() {
      return {
        SetSetingRangVisible: false,
        SetSetingRangValue: null,
        SetSetingRangDesc: null,
        vueparams: this.getVUEParams(""),
        s_step: [],
        loading: false,
        Container: null,
        Container2: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "28847805EE1D403DBCD43478FD18BD08",
        name: "工艺右菜单",
        selected: "工艺工序"
      }, 'Container', this.vueparams);
      this.loadContainerMenu({
        pid: "28847805EE1D403DBCD43478FD18BD08",
        name: "工序上菜单",
        selected: "工序流列表"
      }, 'Container2', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/product/TechnologyAction/processFlowRang?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_step(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/mes/product/TechnologyAction/d_step?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      d_phase(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/mes/product/TechnologyAction/d_phase?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      popSetSetingRang(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.SetSetingRangVisible = !this.SetSetingRangVisible;
      },
    },
  }
</script>
